import jwt

from datetime import datetime
from Forum.settings import settings
current_time = datetime.utcnow()

data = jwt.encode({
    "nickname": "kk",
    "id": 3,
    "exp": current_time
}, settings['secret_key']).decode("utf8")
print(data)

import time
time.sleep(1)

send_data = jwt.decode(data, settings['secret_key'], leeway=settings['jwt_expire'], options={"verify_exp": True})

print(send_data)